﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LIMS.BLL
{
    /// <summary>
    /// 登陆管理类
    /// </summary>
    public class LoginManager
    {

        private static LIMS.IDAL.ILogin iLogin = DALFactory.DataAccess<LIMS.IDAL.ILogin>.CreateObject();

        #region 登陆

        /// <summary>
        /// 
        /// </summary>
        /// <param name="admin"></param>
        /// <returns></returns>
        public static bool AdminLogin(LIMS.Model.Admins admin)
        {
            if (iLogin == null)
            {
                throw new Exception("无法创建反射的实例对象！");
            }
            return iLogin.UserLogin(admin);
        }

        public static bool TeacherLogin(LIMS.Model.Teachers teacher)
        {
            return iLogin.UserLogin(teacher);
        }

        public static bool StudentLogin(LIMS.Model.Students student)
        {
            return iLogin.UserLogin(student);
        }

        #endregion

        #region 注册，检查用户ID

        /// <summary>
        /// 检查指定ID是否属于管理员
        /// </summary>
        /// <param name="admin"></param>
        /// <returns></returns>
        public Boolean Exists(LIMS.Model.Admins admin)
        {
            return iLogin.Exists(admin);
        }

        /// <summary>
        /// 检查指定ID是否属于学生
        /// </summary>
        /// <param name="stu"></param>
        /// <returns></returns>
        public Boolean Exists(LIMS.Model.Students student)
        {
            return iLogin.Exists(student);
        }

        /// <summary>
        /// 检查指定ID是否属于教师
        /// </summary>
        /// <param name="tea"></param>
        /// <returns></returns>
        public Boolean Exists(LIMS.Model.Teachers teacher)
        {
            return iLogin.Exists(teacher);
        }

        #endregion

    }

}
